package com.itheima.es_goods_demo.listener;

import com.itheima.es_goods_demo.utils.KibanaUtil;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;


@Component
public class StartupListener implements ApplicationListener<ContextRefreshedEvent> {

 @Autowired
 private RestHighLevelClient client;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        KibanaUtil.register(client);
    }

}
